package flexo.examples;

public class Test_Graphic_Billboarding extends Test_Graphic_Base
{
	flexo.scene.Node billboardNode;
	flexo.scene.Node gridNode; 
	
	flexo.graphic.Camera cam;
	
	public static void main(String[] args)
	{		
		run("flexo.examples.Test_Graphic_Billboarding");
	}
	
	@Override
	public void init()
	{
		super.init();
				
		flexo.graphic.Material mat = graphic.addMaterial("billMat", "billboard");
		flexo.graphic.ShaderParam param = mat.getShaderParam("tex");
		param.setValue("textures/maptexture.jpg");
		
		billboardNode = mainScene.addChild("billboard");
		gridNode = mainScene.addChild("grid");

		flexo.graphic.entity.Entity billboard = graphic.addQuad(1, 1);
		billboard.setMaterial("billMat");
		billboard.attachTo(billboardNode);
		
		mat = graphic.addMaterial("hud", "billboard");
		mat.setBlending(flexo.graphic.Material.Blending.TRANSPARENT_ADD);
		param = mat.getShaderParam("tex");
		param.setValue("textures/focus.png");
		
		flexo.graphic.entity.Entity hud = graphic.addQuad(0.2f, 0.2f);
		hud.setMaterial("hud");
		hud.attachTo(this.camTargetNode);
		
		mat = graphic.addMaterial("gridMat", "textureRepeat");
		param = mat.getShaderParam("tex");
		param.setValue("textures/grid.png");
		param = mat.getShaderParam("repeatU");
		param.setValue(50.0f);
		param = mat.getShaderParam("repeatV");
		param.setValue(50.0f);
		
		flexo.graphic.entity.Entity grid = graphic.addQuad(50, 50);
		grid.setMaterial("gridMat");
		grid.attachTo(gridNode);
		gridNode.setRotation(new flexo.math.Quaternion(new flexo.math.Vector(1,0,0),-90.0f));
		gridNode.setPosition(new flexo.math.Vector(0,-1,0));		
	}

	public void cleanUp()
	{		
	}	

	public void update()
	{		
	}
}